3.46 \(\int (c+d x) (a+b \tan (e+f x))^2 \, dx\)

Optimal. Leaf size=136 \[ \frac{i a b d \text{PolyLog}\left (2,-e^{2 i (e+f x)}\right )}{f^2}+\frac{a^2 (c+d x)^2}{2 d}-\frac{2 a b (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac{i a b (c+d x)^2}{d}+\frac{b^2 (c+d x) \tan (e+f x)}{f}-b^2 c x+\frac{b^2 d \log (\cos (e+f x))}{f^2}-\frac{1}{2} b^2 d x^2 \]

[Out]

-(b^2*c*x) - (b^2*d*x^2)/2 + (a^2*(c + d*x)^2)/(2*d) + (I*a*b*(c + d*x)^2)/d - (2*a*b*(c + d*x)*Log[1 + E^((2*
I)*(e + f*x))])/f + (b^2*d*Log[Cos[e + f*x]])/f^2 + (I*a*b*d*PolyLog[2, -E^((2*I)*(e + f*x))])/f^2 + (b^2*(c +
 d*x)*Tan[e + f*x])/f

________________________________________________________________________________________

Rubi [A]  time = 0.190461, antiderivative size = 136, normalized size of antiderivative = 1., number of steps used = 9, number of rules used = 7, integrand size = 18, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.389, Rules used = {3722, 3719, 2190, 2279, 2391, 3720, 3475} \[ \frac{a^2 (c+d x)^2}{2 d}-\frac{2 a b (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac{i a b (c+d x)^2}{d}+\frac{i a b d \text{Li}_2\left (-e^{2 i (e+f x)}\right )}{f^2}+\frac{b^2 (c+d x) \tan (e+f x)}{f}-b^2 c x+\frac{b^2 d \log (\cos (e+f x))}{f^2}-\frac{1}{2} b^2 d x^2 \]

Antiderivative was successfully verified.

[In]

Int[(c + d*x)*(a + b*Tan[e + f*x])^2,x]

[Out]

-(b^2*c*x) - (b^2*d*x^2)/2 + (a^2*(c + d*x)^2)/(2*d) + (I*a*b*(c + d*x)^2)/d - (2*a*b*(c + d*x)*Log[1 + E^((2*
I)*(e + f*x))])/f + (b^2*d*Log[Cos[e + f*x]])/f^2 + (I*a*b*d*PolyLog[2, -E^((2*I)*(e + f*x))])/f^2 + (b^2*(c +
 d*x)*Tan[e + f*x])/f

Rule 3722

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[ExpandIntegrand[
(c + d*x)^m, (a + b*Tan[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[m, 0] && IGtQ[n, 0]

Rule 3719

Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[(I*(c + d*x)^(m + 1))/(d*(m + 1)), x
] - Dist[2*I, Int[((c + d*x)^m*E^(2*I*(e + f*x)))/(1 + E^(2*I*(e + f*x))), x], x] /; FreeQ[{c, d, e, f}, x] &&
 IGtQ[m, 0]

Rule 2190

Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/((a_) + (b_.)*((F_)^((g_.)*((e_.) +
 (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp[((c + d*x)^m*Log[1 + (b*(F^(g*(e + f*x)))^n)/a])/(b*f*g*n*Log[F]), x]
 - Dist[(d*m)/(b*f*g*n*Log[F]), Int[(c + d*x)^(m - 1)*Log[1 + (b*(F^(g*(e + f*x)))^n)/a], x], x] /; FreeQ[{F,
a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]

Rule 2279

Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Dist[1/(d*e*n*Log[F]), Subst[Int
[Log[a + b*x]/x, x], x, (F^(e*(c + d*x)))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]

Rule 2391

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> -Simp[PolyLog[2, -(c*e*x^n)]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 3720

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(c + d*x)^m*(b*Tan[e
 + f*x])^(n - 1))/(f*(n - 1)), x] + (-Dist[(b*d*m)/(f*(n - 1)), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int (c+d x) (a+b \tan (e+f x))^2 \, dx &=\int \left (a^2 (c+d x)+2 a b (c+d x) \tan (e+f x)+b^2 (c+d x) \tan ^2(e+f x)\right ) \, dx\\ &=\frac{a^2 (c+d x)^2}{2 d}+(2 a b) \int (c+d x) \tan (e+f x) \, dx+b^2 \int (c+d x) \tan ^2(e+f x) \, dx\\ &=\frac{a^2 (c+d x)^2}{2 d}+\frac{i a b (c+d x)^2}{d}+\frac{b^2 (c+d x) \tan (e+f x)}{f}-(4 i a b) \int \frac{e^{2 i (e+f x)} (c+d x)}{1+e^{2 i (e+f x)}} \, dx-b^2 \int (c+d x) \, dx-\frac{\left (b^2 d\right ) \int \tan (e+f x) \, dx}{f}\\ &=-b^2 c x-\frac{1}{2} b^2 d x^2+\frac{a^2 (c+d x)^2}{2 d}+\frac{i a b (c+d x)^2}{d}-\frac{2 a b (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac{b^2 d \log (\cos (e+f x))}{f^2}+\frac{b^2 (c+d x) \tan (e+f x)}{f}+\frac{(2 a b d) \int \log \left (1+e^{2 i (e+f x)}\right ) \, dx}{f}\\ &=-b^2 c x-\frac{1}{2} b^2 d x^2+\frac{a^2 (c+d x)^2}{2 d}+\frac{i a b (c+d x)^2}{d}-\frac{2 a b (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac{b^2 d \log (\cos (e+f x))}{f^2}+\frac{b^2 (c+d x) \tan (e+f x)}{f}-\frac{(i a b d) \operatorname{Subst}\left (\int \frac{\log (1+x)}{x} \, dx,x,e^{2 i (e+f x)}\right )}{f^2}\\ &=-b^2 c x-\frac{1}{2} b^2 d x^2+\frac{a^2 (c+d x)^2}{2 d}+\frac{i a b (c+d x)^2}{d}-\frac{2 a b (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac{b^2 d \log (\cos (e+f x))}{f^2}+\frac{i a b d \text{Li}_2\left (-e^{2 i (e+f x)}\right )}{f^2}+\frac{b^2 (c+d x) \tan (e+f x)}{f}\\ \end{align*}

Mathematica [A]  time = 2.15947, size = 200, normalized size = 1.47 \[ \frac{\cos (e+f x) (a+b \tan (e+f x))^2 \left (2 i a b d \cos (e+f x) \text{PolyLog}\left (2,-e^{2 i (e+f x)}\right )+\cos (e+f x) \left (-(e+f x) \left (a^2 (-2 c f+d e-d f x)-2 i a b d (e+f x)+b^2 (2 c f-d e+d f x)\right )+2 b \log (\cos (e+f x)) (-2 a c f+2 a d e+b d)-4 a b d (e+f x) \log \left (1+e^{2 i (e+f x)}\right )\right )+2 b^2 f (c+d x) \sin (e+f x)\right )}{2 f^2 (a \cos (e+f x)+b \sin (e+f x))^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(c + d*x)*(a + b*Tan[e + f*x])^2,x]

[Out]

(Cos[e + f*x]*(Cos[e + f*x]*(-((e + f*x)*((-2*I)*a*b*d*(e + f*x) + a^2*(d*e - 2*c*f - d*f*x) + b^2*(-(d*e) + 2
*c*f + d*f*x))) - 4*a*b*d*(e + f*x)*Log[1 + E^((2*I)*(e + f*x))] + 2*b*(b*d + 2*a*d*e - 2*a*c*f)*Log[Cos[e + f
*x]]) + (2*I)*a*b*d*Cos[e + f*x]*PolyLog[2, -E^((2*I)*(e + f*x))] + 2*b^2*f*(c + d*x)*Sin[e + f*x])*(a + b*Tan
[e + f*x])^2)/(2*f^2*(a*Cos[e + f*x] + b*Sin[e + f*x])^2)

________________________________________________________________________________________

Maple [A]  time = 0.099, size = 238, normalized size = 1.8 \begin{align*}{\frac{2\,ibad{e}^{2}}{{f}^{2}}}+{\frac{2\,i{b}^{2} \left ( dx+c \right ) }{f \left ({{\rm e}^{2\,i \left ( fx+e \right ) }}+1 \right ) }}+{\frac{{a}^{2}d{x}^{2}}{2}}-{\frac{{b}^{2}d{x}^{2}}{2}}+{a}^{2}cx-{b}^{2}cx+{\frac{iabd{\it polylog} \left ( 2,-{{\rm e}^{2\,i \left ( fx+e \right ) }} \right ) }{{f}^{2}}}+{\frac{{b}^{2}d\ln \left ({{\rm e}^{2\,i \left ( fx+e \right ) }}+1 \right ) }{{f}^{2}}}-2\,{\frac{{b}^{2}d\ln \left ({{\rm e}^{i \left ( fx+e \right ) }} \right ) }{{f}^{2}}}+4\,{\frac{abc\ln \left ({{\rm e}^{i \left ( fx+e \right ) }} \right ) }{f}}-2\,{\frac{abc\ln \left ({{\rm e}^{2\,i \left ( fx+e \right ) }}+1 \right ) }{f}}-4\,{\frac{abde\ln \left ({{\rm e}^{i \left ( fx+e \right ) }} \right ) }{{f}^{2}}}+iabd{x}^{2}+{\frac{4\,ibadex}{f}}-2\,iabcx-2\,{\frac{b\ln \left ({{\rm e}^{2\,i \left ( fx+e \right ) }}+1 \right ) adx}{f}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)*(a+b*tan(f*x+e))^2,x)

[Out]

2*I*b/f^2*a*d*e^2+2*I*b^2*(d*x+c)/f/(exp(2*I*(f*x+e))+1)+1/2*a^2*d*x^2-1/2*b^2*d*x^2+a^2*c*x-b^2*c*x+I*a*b*d*p
olylog(2,-exp(2*I*(f*x+e)))/f^2+b^2/f^2*d*ln(exp(2*I*(f*x+e))+1)-2*b^2/f^2*d*ln(exp(I*(f*x+e)))+4*b/f*a*c*ln(e
xp(I*(f*x+e)))-2*b/f*a*c*ln(exp(2*I*(f*x+e))+1)-4*b/f^2*a*d*e*ln(exp(I*(f*x+e)))+I*a*b*d*x^2+4*I*b/f*a*d*e*x-2
*I*a*b*c*x-2*b/f*ln(exp(2*I*(f*x+e))+1)*a*d*x

________________________________________________________________________________________

Maxima [B]  time = 1.76626, size = 714, normalized size = 5.25 \begin{align*} \frac{2 \,{\left (f x + e\right )} a^{2} c + \frac{{\left (f x + e\right )}^{2} a^{2} d}{f} - \frac{2 \,{\left (f x + e\right )} a^{2} d e}{f} + 4 \, a b c \log \left (\sec \left (f x + e\right )\right ) - \frac{4 \, a b d e \log \left (\sec \left (f x + e\right )\right )}{f} + \frac{2 \,{\left ({\left (2 \, a b + i \, b^{2}\right )}{\left (f x + e\right )}^{2} d - 4 \, b^{2} d e + 4 \, b^{2} c f -{\left (2 i \, b^{2} d e - 2 i \, b^{2} c f\right )}{\left (f x + e\right )} -{\left (4 \,{\left (f x + e\right )} a b d - 2 \, b^{2} d + 2 \,{\left (2 \,{\left (f x + e\right )} a b d - b^{2} d\right )} \cos \left (2 \, f x + 2 \, e\right ) +{\left (4 i \,{\left (f x + e\right )} a b d - 2 i \, b^{2} d\right )} \sin \left (2 \, f x + 2 \, e\right )\right )} \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) +{\left ({\left (2 \, a b + i \, b^{2}\right )}{\left (f x + e\right )}^{2} d -{\left (2 i \, b^{2} d e - 2 i \, b^{2} c f + 4 \, b^{2} d\right )}{\left (f x + e\right )}\right )} \cos \left (2 \, f x + 2 \, e\right ) +{\left (2 \, a b d \cos \left (2 \, f x + 2 \, e\right ) + 2 i \, a b d \sin \left (2 \, f x + 2 \, e\right ) + 2 \, a b d\right )}{\rm Li}_2\left (-e^{\left (2 i \, f x + 2 i \, e\right )}\right ) -{\left (-2 i \,{\left (f x + e\right )} a b d + i \, b^{2} d +{\left (-2 i \,{\left (f x + e\right )} a b d + i \, b^{2} d\right )} \cos \left (2 \, f x + 2 \, e\right ) +{\left (2 \,{\left (f x + e\right )} a b d - b^{2} d\right )} \sin \left (2 \, f x + 2 \, e\right )\right )} \log \left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) -{\left ({\left (-2 i \, a b + b^{2}\right )}{\left (f x + e\right )}^{2} d -{\left (2 \, b^{2} d e - 2 \, b^{2} c f - 4 i \, b^{2} d\right )}{\left (f x + e\right )}\right )} \sin \left (2 \, f x + 2 \, e\right )\right )}}{-2 i \, f \cos \left (2 \, f x + 2 \, e\right ) + 2 \, f \sin \left (2 \, f x + 2 \, e\right ) - 2 i \, f}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

1/2*(2*(f*x + e)*a^2*c + (f*x + e)^2*a^2*d/f - 2*(f*x + e)*a^2*d*e/f + 4*a*b*c*log(sec(f*x + e)) - 4*a*b*d*e*l
og(sec(f*x + e))/f + 2*((2*a*b + I*b^2)*(f*x + e)^2*d - 4*b^2*d*e + 4*b^2*c*f - (2*I*b^2*d*e - 2*I*b^2*c*f)*(f
*x + e) - (4*(f*x + e)*a*b*d - 2*b^2*d + 2*(2*(f*x + e)*a*b*d - b^2*d)*cos(2*f*x + 2*e) + (4*I*(f*x + e)*a*b*d
 - 2*I*b^2*d)*sin(2*f*x + 2*e))*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) + ((2*a*b + I*b^2)*(f*x + e)^2
*d - (2*I*b^2*d*e - 2*I*b^2*c*f + 4*b^2*d)*(f*x + e))*cos(2*f*x + 2*e) + (2*a*b*d*cos(2*f*x + 2*e) + 2*I*a*b*d
*sin(2*f*x + 2*e) + 2*a*b*d)*dilog(-e^(2*I*f*x + 2*I*e)) - (-2*I*(f*x + e)*a*b*d + I*b^2*d + (-2*I*(f*x + e)*a
*b*d + I*b^2*d)*cos(2*f*x + 2*e) + (2*(f*x + e)*a*b*d - b^2*d)*sin(2*f*x + 2*e))*log(cos(2*f*x + 2*e)^2 + sin(
2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1) - ((-2*I*a*b + b^2)*(f*x + e)^2*d - (2*b^2*d*e - 2*b^2*c*f - 4*I*b^2*
d)*(f*x + e))*sin(2*f*x + 2*e))/(-2*I*f*cos(2*f*x + 2*e) + 2*f*sin(2*f*x + 2*e) - 2*I*f))/f

________________________________________________________________________________________

Fricas [A]  time = 1.68379, size = 540, normalized size = 3.97 \begin{align*} \frac{{\left (a^{2} - b^{2}\right )} d f^{2} x^{2} + 2 \,{\left (a^{2} - b^{2}\right )} c f^{2} x - i \, a b d{\rm Li}_2\left (\frac{2 \,{\left (i \, \tan \left (f x + e\right ) - 1\right )}}{\tan \left (f x + e\right )^{2} + 1} + 1\right ) + i \, a b d{\rm Li}_2\left (\frac{2 \,{\left (-i \, \tan \left (f x + e\right ) - 1\right )}}{\tan \left (f x + e\right )^{2} + 1} + 1\right ) -{\left (2 \, a b d f x + 2 \, a b c f - b^{2} d\right )} \log \left (-\frac{2 \,{\left (i \, \tan \left (f x + e\right ) - 1\right )}}{\tan \left (f x + e\right )^{2} + 1}\right ) -{\left (2 \, a b d f x + 2 \, a b c f - b^{2} d\right )} \log \left (-\frac{2 \,{\left (-i \, \tan \left (f x + e\right ) - 1\right )}}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \,{\left (b^{2} d f x + b^{2} c f\right )} \tan \left (f x + e\right )}{2 \, f^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

1/2*((a^2 - b^2)*d*f^2*x^2 + 2*(a^2 - b^2)*c*f^2*x - I*a*b*d*dilog(2*(I*tan(f*x + e) - 1)/(tan(f*x + e)^2 + 1)
 + 1) + I*a*b*d*dilog(2*(-I*tan(f*x + e) - 1)/(tan(f*x + e)^2 + 1) + 1) - (2*a*b*d*f*x + 2*a*b*c*f - b^2*d)*lo
g(-2*(I*tan(f*x + e) - 1)/(tan(f*x + e)^2 + 1)) - (2*a*b*d*f*x + 2*a*b*c*f - b^2*d)*log(-2*(-I*tan(f*x + e) -
1)/(tan(f*x + e)^2 + 1)) + 2*(b^2*d*f*x + b^2*c*f)*tan(f*x + e))/f^2

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a + b \tan{\left (e + f x \right )}\right )^{2} \left (c + d x\right )\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*tan(f*x+e))**2,x)

[Out]

Integral((a + b*tan(e + f*x))**2*(c + d*x), x)

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (d x + c\right )}{\left (b \tan \left (f x + e\right ) + a\right )}^{2}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*tan(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((d*x + c)*(b*tan(f*x + e) + a)^2, x)